var Watcher = function(vm,exp,cb,data){
     this.$vm = vm;
     this.$exp = exp;
     this.$cb = cb;
     this.data =data;
     
     this.value = this.getter();
}

Watcher.prototype = {
    update(){
        this.oldValue = this.value;
        this.value = this.getter();
        if(this.value !== this.oldValue){
            this.$cb(this.value,this.oldValue);
        }
    },
    getter(){
        Dep.target = this;
        var value = this.get();
        Dep.target = null;
        return value;
    },
    addDep(dep){
        // Dep.target = this;
        // console.log(123)
        // console.log('watcher',this)
        dep.addWatcher(this);
        // Dep.target = null;
    },
    get(){
        return this.data[this.$exp]
    }
}